﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>


<form id="addtolightbox" name="addtolightbox">
<div style="float: left;">
Chọn lightbox 

<select id="lightbox" name="lightbox">
<% 
    List<VietImage.Models.Lightbox> myLightboxes = (List<VietImage.Models.Lightbox>)ViewData["LightboxList"];
    if (myLightboxes != null)
    {
        foreach (VietImage.Models.Lightbox lb in myLightboxes)
        {
%>
                        <option value="<%= lb.ID %>"><%= lb.Name%></option>
<% 
        }
    }
%>
</select>
<input type="submit" value="Thêm vào" style="display:none;" />
</div>
                    <div class="button" style="cursor:pointer; float: left;" onmouseout="buttonmouseout('addtolightbox');" onmousedown="buttonmousedown('addtolightbox');" onmouseover="buttonmouseover('addtolightbox');"><table cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td id="lbtnaddtolightbox" class="left-button"></td>
                            <td id="mbtnaddtolightbox" class="middle-button"><span style="color:White;">Thêm vào</span></td>
                            <td id="rbtnaddtolightbox" class="right-button"></td>                        
                        </tr>          
                    </table></div>                    

</form>
<div style="clear: both;"></div>
<form id="addtonewlightbox" name="addtonewlightbox">
Thêm vào lightbox mới: <br />
<div style="float: left;">
Tên lightbox mới 
<input type="text" id="newlightbox" name="newlightbox" value="" />
<input type="submit" value="Thêm vào" style="display:none;" />
<input type="hidden" id="imgid" value="<%= Request["id"] %>" />
 </div>
                    <div class="button" style="cursor:pointer; float: left;" onmouseout="buttonmouseout('addtonewlightbox');" onmousedown="buttonmousedown('addtonewlightbox');" onmouseover="buttonmouseover('addtonewlightbox');"><table cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td id="lbtnaddtonewlightbox" class="left-button"></td>
                            <td id="mbtnaddtonewlightbox" class="middle-button"><span style="color:White;">Thêm vào</span></td>
                            <td id="rbtnaddtonewlightbox" class="right-button"></td>                        
                        </tr>          
                    </table></div>                    

</form>

<script>
    $(".button").click(function () {
        $(this).parent("form").submit();
    });

    $("#addtolightbox").submit(function () {
        var lbid = $("#lightbox").val();
        var imgid = $("#imgid").val();
        var d = "id=" + lbid + "&imgid=" + imgid;
        ajaxalertresult('<%= Url.Action("AddToLightbox", "Lightbox") %>', d);
        return false;
    });

    $("#addtonewlightbox").submit(function () {
        var imgid = $("#imgid").attr("imgid");
        var lbname = $("#newlightbox").attr("imgid");
        var d = "name=" + lbname + "&imgid=" + imgid;
        ajaxalertresult('<%= Url.Action("AddToNewLightbox", "Lightbox") %>', d);
        return false;
    });

</script>
